/************************************************************************/
/* Name : Kiwon Yun
/* Partner's name : Eric Rooney
/* File Name : GameInfo.h
/* The name of assignment : Iteration 2
/************************************************************************/

#ifndef RULEMANAGER_H
#define RULEMANAGER_H

#include "Common.h"

// ranking
enum Ranking
{
	StraitFlush, 
	FourOfAKind,
	FullHouse,
	Flush,
	Strait,
	ThreeOfAKind,
	TwoPair,
	OnePair,
	HighCard,
	MaxRankingNum,
};

// ranking and score
struct RankScore
{
	Ranking ranking;
	int nScore;			// the score in the same ranking
};

typedef vector <int> VecInt;

/************************************************************************/
/* RuleManager class manages game rule.
/* This class know all poker rules, 
/* and this class can decide winning set.
/************************************************************************/
class Player;
class Hand;
struct Card;
class RuleManager
{
public:
	RuleManager(void);
	virtual ~RuleManager(void);

	/* Select the winner */
	Player* SelectWinner( Player* a_pPlayer1, Player* a_pPlayer2 );
	/*rank the players according to score */
	RankScore* GetRankScore( Hand* a_pHand );

	/* Determine if all cards are the same suit*/
	bool CheckAllCardsAreSameSuit( Hand* a_pHand, RankScore* a_pRankScore );
	/* Determine if all the cards are ordered*/
	bool CheckAllCardsAreOrdered( Hand* a_pHand, RankScore* a_pRankScore );
	/* Determine if some cards are same value - check pair cards 
	/* (Four of kind, Full house, Three of kind, Two pair, One pair, High card) */
	Ranking CheckCardsAreSameValue( Hand* a_pHand, RankScore* a_pRankScore );

	/* Output the score*/
	void PrintRankScore( RankScore* a_pRankScore );
	/* Get the winners rank*/
	RankScore* GetWinnerRankScore( RankScore* a_pRankScore1, RankScore* a_pRankScore2 );
	/* Calculate score*/
	int GetScore( VecInt a_vecValue );
	
	/* convert from integer to score*/
	int ConvertIntegerToScore( int a_nInteger );
};

#endif
